#ifndef __HAL_UART_H__
#define __HAL_UART_H__

/*===========================================================================

                          Type definition.

===========================================================================*/

typedef enum /* The number of ports in the UART  */
{
    UART_PORT_FFUART,
    UART_PORT_1 = UART_PORT_FFUART,
    UART_PORT_BTUART,
    UART_PORT_2 = UART_PORT_BTUART,
    UART_PORT_STUART,
    UART_PORT_3 = UART_PORT_STUART,
    USB_MODEM_PORT,
    UART_PORT_4 = USB_MODEM_PORT,
    USB_TTY_PORT,
    UART_PORT_5 = USB_TTY_PORT,
    NUMBER_OF_PORTS,
} UART_Port;

typedef enum /* All the UART Baud Rate that the UART Package supplay */
{
    UART_BAUD_150 = 150,
    UART_BAUD_300 = 300,
    UART_BAUD_600 = 600,
    UART_BAUD_1200 = 1200,
    UART_BAUD_2400 = 2400,
    UART_BAUD_3600 = 3600,
    UART_BAUD_4800 = 4800,
    UART_BAUD_7200 = 7200,
    UART_BAUD_9600 = 9600,
    UART_BAUD_14400 = 14400,
    UART_BAUD_19200 = 19200,
    UART_BAUD_28800 = 28800,
    UART_BAUD_38400 = 38400,
    UART_BAUD_57600 = 57600,
    UART_BAUD_115200 = 115200,
    UART_BAUD_230400 = 230400,
    UART_BAUD_460800 = 460800,
    UART_BAUD_921600 = 921600,
    UART_BAUD_1842000 = 1842000,
    UART_BAUD_3686400 = 3686400,
    UART_MAX_NUM_BAUD
} UART_BaudRates;

typedef struct
{
    UINT32 length;
    UINT8 *data;
} UartRxMsg_Type;

/*===========================================================================

                          INTERNAL FUNCTION DECLARATIONS

===========================================================================*/
void hal_UartOpen(UART_Port portNumber, UART_BaudRates baud, OSMsgQRef uartMsgQ);
void hal_UartClose(UART_Port portNumber);
void hal_UartWrite(UART_Port portNumber, const UINT8 *bufPtr, UINT32 length);
size_t hal_UartRead(UART_Port portNumber, UINT8 *bufPtr, UINT32 length);

#endif
